import { fallbackRequestGet, fallbackRequestPost } from '@utils/Request'

/**
 * 请求前缀，后面后台添加网关后需要前缀选择微服务
 */
const URL_PREFIX = 'middle-user/'

/**
 * 查询所有用户验证方式
 * @param {Function} successCallback 成功回调，参数为data
 * @param {Function} fullCallback 肯定触发的回调，先于callback
 */
export const query = (successCallback = null, fullCallback = null) => {
  const params = {}
  return fallbackRequestGet(URL_PREFIX + 'verifyType/query', params, {}, true, successCallback, null, fullCallback)
}

/**
 * 通过id查询用户验证方式
 * @param {BigInteger} id id
 * @param {Function} successCallback 成功回调，参数为data
 * @param {Function} fullCallback 肯定触发的回调，先于callback
 */
export const queryById = (id, successCallback = null, fullCallback = null) => {
  const params = {}
  return fallbackRequestGet(URL_PREFIX + 'verifyType/queryById', params, {}, true, successCallback, null, fullCallback)
}

/**
 * 根据id列表查询多个用户验证方式
 * @param {Array} ids ids
 * @param {Function} successCallback 成功回调，参数为data
 * @param {Function} fullCallback 肯定触发的回调，先于callback
 */
export const queryByIds = (ids, successCallback = null, fullCallback = null) => {
  const params = {}
  return fallbackRequestPost(URL_PREFIX + 'verifyType/queryByIds', params, {}, true, successCallback, null, fullCallback)
}

/**
 * 查询所有用户验证方式
 * @param {String} name 验证方式名称
 * @param {Function} successCallback 成功回调，参数为data
 * @param {Function} fullCallback 肯定触发的回调，先于callback
 */
export const queryByName = (name, successCallback = null, fullCallback = null) => {
  const params = {}
  return fallbackRequestGet(URL_PREFIX + 'verifyType/queryByName', params, {}, true, successCallback, null, fullCallback)
}
